<button id ="btn">按钮</button>
<script>
    var id = "6666"
    var btn = document.getElementById("btn");
    btn.onclick = function(){
        console.log(this.id); //return btn
        setTimeout(function(){
            console.log(this.id); //return 6666  因为这里定时器的实际写法是window.setTimeout(...)
        },100)

        // 解决办法1
        setTimeout(function(){
            console.log(this.id);
        }.bind(this),100)

        // 解决办法2
        setTimeout(()=>{
            console.log(this.id);
        },100)
    }
</script>